<?php

/**
 * Created by PhpStorm.
 * User: Yieong
 * Date: 2017/6/13
 * Time: 下午11:10
 */
class RankingService extends Service {

    // 服务器货币消耗排行 - 表头
    public static function serverHeader(){
        return array(
            'No'        => array('text' => '排行'),
            'RoleID'    => array('text' => '角色ID'),
            'RoleName'  => array('text' => '角色名'),
            'GetNumber' => array('text' => '消费货币','rule'=>'numeric'),
        );
    }

    // 服务器货币消耗排行 - 数据
    public static function serverData($params){
        $tmp = ModRanking::serverData($params);

        $result = array();

        $userArr = array();
        foreach($tmp as $v){
            $userArr[$v['RoleID']] = $v['RoleID'];
        }
//        $dict = LogRoleService::getDictByUser($userArr);

        $index   = 1;
        foreach($tmp as $v){
            $v['No'] = $index++;

//            if(isset($dict[$v['RoleID']])){
//                $v['RoleName'] = $dict[$v['RoleID']]['name'].' <a target="_blank" href="/oss/?r=role/index&m=36&g=roma&server='.$dict[$v['RoleID']]['server'].'&search='.$v['RoleID'].'"><i class="fa fa-info-circle"></i></a>';
//            }

            $result[] = $v;
        }

        return $result;
    }

}